<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      /* div {
        width: 200px;
        height: 200px;
        background: red;
      } */
    </style>
  </head>
  <body>
    <!-- <div id="box"></div> -->
    <a href="//www.taobao.com">
      <div>无效</div>
      <p id="link">跳到baidu</p>
    </a>
  </body>
  <script>
    // var box = document.querySelector('#box')
    // box.addEventListener('click', function () {
    //   console.log('click')
    // })
    // box.addEventListener('touchstart', function () {
    //   console.log('touchstart')
    // })
    // box.addEventListener('touchend', function () {
    //   console.log('touchend')
    // })

    var link = document.querySelector('#link')
    link.addEventListener('click', function (event) {
      event.preventDefault() //阻止默认事件
      location.href = '//www.baidu.com'
    })
  </script>
</html>
